package com.glsc.ngateway.common.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * OA结束消息后，描述字段示例枚举
 *
 * @author xuchang
 */
@Getter
@AllArgsConstructor
public enum OaFlowSyncMessageDescriptionEnum {
    END("流程结束"),
    PASS("审批通过"),
    REJECT("退回"),
    ;

    /**
     * 描述
     */
    private final String desc;

    public static Optional<OaFlowSyncMessageDescriptionEnum> valuesOf(String desc){
        return Arrays.stream(OaFlowSyncMessageDescriptionEnum.values()).filter(m->m.getDesc().equals(desc)).findFirst();
    }

    public boolean isEnd(){
        return OaFlowSyncMessageDescriptionEnum.END.getDesc().equals(this.desc);
    }

    public boolean isPass(){
        return OaFlowSyncMessageDescriptionEnum.PASS.getDesc().equals(desc);
    }

    public boolean isReject(){
        return OaFlowSyncMessageDescriptionEnum.REJECT.getDesc().equals(desc);
    }
}
